Description
Draws some shapes on the screen using the DrawShape method of the Map object.
VBScript Code
Copy Code | |
---|---|
Sub DrawShapes 'Create an ellipse object and set its extent to the map extent Dim pEllipse Set pEllipse = Application.CreateAppObject("Ellipse") pEllipse.Extent = Map.Extent 'Create a symbol object Dim pSymbol Set pSymbol = Application.CreateAppObject("Symbol") 'Set symbol properties for drawing the ellipse pSymbol.FillStyle = 0 'solid pSymbol.LineWidth = 3 pSymbol.LineColor = 33023 'orange pSymbol.FillColor = 16776960 'cyan 'Draw the ellipse with the specified symbology Call Map.DrawShape(pEllipse, pSymbol) 'Modify the ellipse pEllipse.left = 0.0 pEllipse.right = 4.0 pEllipse.top = 3.5 pEllipse.bottom = 0.5 'Modify the symbol properties for drawing the modified ellipse pSymbol.BackgroundMode = 2 'opaque pSymbol.BackgroundColor = 65535 'yellow pSymbol.FillStyle = 2 'hatch pSymbol.FillHatch = 5 'diagonal cross pSymbol.LineWidth = 2 pSymbol.LineColor = 16711680 'blue 'Draw the modified ellipse with the updated symbology Call Map.DrawShape(pEllipse, pSymbol) 'Create a points collection and point object Dim pPoints, pPoint Set pPoints = Application.CreateAppObject("Points") Set pPoint = Application.CreateAppObject("Point") 'Populate the points collection Dim dblX, dblY For dblY = 1 To 3 For dblX = 1 To 3 pPoint.X = dblX pPoint.Y = dblY pPoints.Add pPoint Next Next 'Create a line object and add the points collection to it Dim pLine Set pLine = Application.CreateAppObject("Line") Call pLine.Parts.Add(pPoints) 'Modify the symbol object for drawing the line pSymbol.LineColor = 4210816 'brown pSymbol.LineWidth = 2 'Draw the line with the updated symbology Call Map.DrawShape(pLine, pSymbol) 'Modify the symbol object for drawing the points collection pSymbol.MarkerStyle = 4 'star pSymbol.MarkerSize = 10 pSymbol.MarkerAngle = 30 pSymbol.LineColor = 0 'black pSymbol.LineWidth = 0 pSymbol.FillStyle = 0 'solid pSymbol.FillColor = 65280 'green 'Draw the points collection with the updated symbology Call Map.DrawShape(pPoints, pSymbol) 'Free Resources Set pSymbol = Nothing Set pLine = Nothing Set pPoint = Nothing Set pPoints = Nothing Set pEllipse = Nothing End Sub |